<!DOCTYPE html>
<html lang="zh">
    <head>
    <!--
        © Material Theme
        https://github.com/viosey/hexo-theme-material
        Version: 1.3.4 -->

    <!-- Title -->
    
    <title>
        
            Linux系统管理---进程管理（查看进程、终止进程、更改进程优先级） | 
        
        Twilight&#39;s Blog
    </title>

    <!-- Meta & Info -->
    <meta charset="utf-8">

    <!-- dns prefetch -->
    <meta http-equiv="x-dns-prefetch-control" content="on">
    
    
        <link rel="dns-prefetch" href="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"/>
    
    
        <link rel="dns-prefetch" href="https://changyan.sohu.com"/>
    
    
    
    

    <meta http-equiv="X-UA-Compatible">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="theme-color" content="#0097A7">
    <meta name="author" content="wangchao">
    <meta name="description" content="null">
    <meta name="keywords" content="null,Linux">

    <!-- Favicons -->
    <link rel="icon shortcut" type="image/ico" href="/img/favicon.png">
    <link rel="icon" sizes="192x192" href="/img/favicon.png">
    <link rel="apple-touch-icon" href="/img/favicon.png">

    <!--iOS -->
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-title" content="Title">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="HandheldFriendly" content="True">
    <meta name="MobileOptimized" content="480">

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Twilight&#39;s Blog">

    <!-- The Open Graph protocol -->
    <meta property="og:url" content="http://yoursite.com">
    <meta property="og:type" content="blog">
    <meta property="og:title" content="Linux系统管理---进程管理（查看进程、终止进程、更改进程优先级） | Twilight&#39;s Blog">
    <meta property="og:description" content="null">
    <meta property="og:article:tag" content="Linux"> 

    <!--[if lte IE 9]>
        <link rel="stylesheet" href="/css/ie-blocker.css">

        
            <script src="/js/ie-blocker.zhCN.js"></script>
        
    <![endif]-->

    <!-- Import CSS & jQuery -->
    
        <link rel="stylesheet" href="/css/material.min.css">
        <link rel="stylesheet" href="/css/style.min.css">
        <!-- Config CSS -->


<!-- Other Styles -->
<style>
  body, html {
    font-family: Roboto, "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  }

  a {
    color: #00838F;
  }

  .mdl-card__media,
  #search-label,
  #search-form-label:after,
  #scheme-Paradox .hot_tags-count,
  #scheme-Paradox .sidebar_archives-count,
  #scheme-Paradox .sidebar-colored .sidebar-header,
  #scheme-Paradox .sidebar-colored .sidebar-badge{
    background-color: #0097A7 !important;
  }

  /* Sidebar User Drop Down Menu Text Color */
  #scheme-Paradox .sidebar-colored .sidebar-nav>.dropdown>.dropdown-menu>li>a:hover,
  #scheme-Paradox .sidebar-colored .sidebar-nav>.dropdown>.dropdown-menu>li>a:focus {
    color: #0097A7 !important;
  }

  #post_entry-right-info,
  .sidebar-colored .sidebar-nav li:hover > a,
  .sidebar-colored .sidebar-nav li:hover > a i,
  .sidebar-colored .sidebar-nav li > a:hover,
  .sidebar-colored .sidebar-nav li > a:hover i,
  .sidebar-colored .sidebar-nav li > a:focus i,
  .sidebar-colored .sidebar-nav > .open > a,
  .sidebar-colored .sidebar-nav > .open > a:hover,
  .sidebar-colored .sidebar-nav > .open > a:focus,
  #ds-reset #ds-ctx .ds-ctx-entry .ds-ctx-head a {
    color: #0097A7 !important;
  }

  .toTop {
    background: #757575 !important;
  }

  .material-layout .material-post>.material-nav,
  .material-layout .material-index>.material-nav,
  .material-nav a {
    color: #757575;
  }

  #scheme-Paradox .MD-burger-layer {
    background-color: #757575;
  }

  #scheme-Paradox #post-toc-trigger-btn {
    color: #757575;
  }

  .post-toc a:hover {
    color: #00838F;
    text-decoration: underline;
  }

</style>


<!-- Theme Background Related-->

    <style>
      body{
        background-image: url(/img/bg.jpg);
      }
    </style>




<!-- Fade Effect -->

    <style>
      .fade {
        transition: all 800ms linear;
        -webkit-transform: translate3d(0,0,0);
        -moz-transform: translate3d(0,0,0);
        -ms-transform: translate3d(0,0,0);
        -o-transform: translate3d(0,0,0);
        transform: translate3d(0,0,0);
        opacity: 1;
      }

      .fade.out{
        opacity: 0;
      }
    </style>


        <script src="/js/jquery.min.js"></script>
        <script src="/js/queue.js"></script>
    

    <!-- UC Browser Compatible -->
    <script>
        var agent = navigator.userAgent.toLowerCase();
        if(agent.indexOf('ucbrowser')>0) {
            document.write("<link rel=\"stylesheet\" href=\"/css/uc.css\">");
            alert('由于 UC 浏览器使用极旧的内核，而本网站使用了一些新的特性。\n为了您能更好的浏览，推荐使用 Chrome 或 Firefox 浏览器。');
        }
    </script>

    

    


    <!-- Bing Background -->
    

    <!-- Custom Head -->
    
</head>


    
        <body id="scheme-Paradox" class="lazy">
            <div class="material-layout  mdl-js-layout has-drawer is-upgraded">
                

                <!-- Main Container -->
                <main class="material-layout__content" id="main">

                    <!-- Top Anchor -->
                    <div id="top"></div>

                    
                        <!-- Hamburger Button -->
                        <button class="MD-burger-icon sidebar-toggle">
                            <span class="MD-burger-layer"></span>
                        </button>
                    

                    <!-- Post TOC -->

    
    <!-- Back Button -->
    <!--
    <div class="material-back" id="backhome-div" tabindex="0">
        <a class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon"
           href="#" onclick="window.history.back();return false;"
           target="_self"
           role="button"
           data-upgraded=",MaterialButton,MaterialRipple">
            <i class="material-icons" role="presentation">arrow_back</i>
            <span class="mdl-button__ripple-container">
                <span class="mdl-ripple"></span>
            </span>
        </a>
    </div>
    -->

    <!-- Left aligned menu below button -->
    <button id="post-toc-trigger-btn"
        class="mdl-button mdl-js-button mdl-button--icon">
        <i class="material-icons">format_list_numbered</i>
    </button>

    <ul class="post-toc-wrap mdl-menu mdl-menu--bottom-left mdl-js-menu mdl-js-ripple-effect" for="post-toc-trigger-btn" style="max-height:80vh; overflow-y:scroll;">
        <ol class="post-toc"><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#查看进程"><span class="post-toc-number">1.</span> <span class="post-toc-text">查看进程</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#ps"><span class="post-toc-number">1.1.</span> <span class="post-toc-text">ps</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#pstree-命令"><span class="post-toc-number">1.2.</span> <span class="post-toc-text">pstree 命令</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#top-命令"><span class="post-toc-number">2.</span> <span class="post-toc-text">top 命令</span></a></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#终止进程"><span class="post-toc-number">3.</span> <span class="post-toc-text">终止进程</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#kill-l-命令"><span class="post-toc-number">3.1.</span> <span class="post-toc-text">kill -l 命令</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#killall-命令"><span class="post-toc-number">3.2.</span> <span class="post-toc-text">killall 命令</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#pkill-命令"><span class="post-toc-number">3.3.</span> <span class="post-toc-text">pkill 命令</span></a></li></ol></li><li class="post-toc-item post-toc-level-1"><a class="post-toc-link" href="#修改进程优先级"><span class="post-toc-number">4.</span> <span class="post-toc-text">修改进程优先级</span></a><ol class="post-toc-child"><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#nice-命令"><span class="post-toc-number">4.1.</span> <span class="post-toc-text">nice 命令</span></a></li><li class="post-toc-item post-toc-level-2"><a class="post-toc-link" href="#renice-命令"><span class="post-toc-number">4.2.</span> <span class="post-toc-text">renice 命令</span></a></li></ol></li></ol>

        <!--
        <li class="mdl-menu__item">
            Some Action
        </li>
        -->
    </ul>




<!-- Layouts -->

    <!-- Post Module -->
    <div class="material-post_container">

        <div class="material-post mdl-grid">
            <div class="mdl-card mdl-shadow--4dp mdl-cell mdl-cell--12-col">

                <!-- Post Header(Thumbnail & Title) -->
                
    <!-- Paradox Post Header -->
    
        <!-- Custom Thumbnail -->
        <div class="post_thumbnail-custom mdl-card__media mdl-color-text--grey-50" style="background-image:url(http://otbrtx8bw.bkt.clouddn.com/1.jpg)">
    
            <p class="article-headline-p">
                Linux系统管理---进程管理（查看进程、终止进程、更改进程优先级）
            </p>
        </div>





                
                    <!-- Paradox Post Info -->
                    <div class="mdl-color-text--grey-700 mdl-card__supporting-text meta">

    <!-- Author Avatar -->
    <div id="author-avatar">
        <img src="/img/avatar.png" width="44px" height="44px" alt="Author Avatar"/>
    </div>
    <!-- Author Name & Date -->
    <div>
        <strong>wangchao</strong>
        <span>8月 25, 2017</span>
    </div>

    <div class="section-spacer"></div>

    <!-- Favorite -->
    <!--
        <button id="article-functions-like-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon btn-like">
            <i class="material-icons" role="presentation">favorite</i>
            <span class="visuallyhidden">favorites</span>
        </button>
    -->

    <!-- Qrcode -->
    

    <!-- Tags (bookmark) -->
    
    <button id="article-functions-viewtags-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
        <i class="material-icons" role="presentation">bookmark</i>
        <span class="visuallyhidden">bookmark</span>
    </button>
    <ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-functions-viewtags-button">
        <li class="mdl-menu__item">
        <a class="post_tag-link" href="/tags/Linux/">Linux</a>
    </ul>
    

    <!-- Share -->
    <button id="article-fuctions-share-button" class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon">
    <i class="material-icons" role="presentation">share</i>
    <span class="visuallyhidden">share</span>
</button>
<ul class="mdl-menu mdl-menu--bottom-right mdl-js-menu mdl-js-ripple-effect" for="article-fuctions-share-button">
    
    <!-- Leancloud Views -->
        <a class="post_share-link" href="#">
            <li class="mdl-menu__item">
                <span id="/2017/08/25/Linux系统管理-进程管理（查看进程、终止进程、更改进程优先级）/" class="leancloud-views_num" data-flag-title="Linux系统管理---进程管理（查看进程、终止进程、更改进程优先级）">
     &nbsp;浏览量
</span>

            </li>
        </a>
    

    

    <!-- Share Weibo -->
    
        <a class="post_share-link" href="http://service.weibo.com/share/share.php?appkey=&title=Linux系统管理---进程管理（查看进程、终止进程、更改进程优先级）&url=http://yoursite.com//2017/08/25/Linux系统管理-进程管理（查看进程、终止进程、更改进程优先级）/index.html&pic=&searchPic=false&style=simple" target="_blank">
            <li class="mdl-menu__item">
                分享到微博
            </li>
        </a>
    

    <!-- Share Twitter -->
    
        <a class="post_share-link" href="https://twitter.com/intent/tweet?text=Linux系统管理---进程管理（查看进程、终止进程、更改进程优先级）&url=http://yoursite.com//2017/08/25/Linux系统管理-进程管理（查看进程、终止进程、更改进程优先级）/index.html&via=wangchao" target="_blank">
            <li class="mdl-menu__item">
                分享到 Twitter
            </li>
        </a>
    

    <!-- Share Facebook -->
    
        <a class="post_share-link" href="https://www.facebook.com/sharer/sharer.php?u=http://yoursite.com//2017/08/25/Linux系统管理-进程管理（查看进程、终止进程、更改进程优先级）/index.html" target="_blank">
            <li class="mdl-menu__item">
                分享到 Facebook
            </li>
        </a>
    

    <!-- Share Google+ -->
    
        <a class="post_share-link" href="https://plus.google.com/share?url=http://yoursite.com//2017/08/25/Linux系统管理-进程管理（查看进程、终止进程、更改进程优先级）/index.html" target="_blank">
            <li class="mdl-menu__item">
                分享到 Google+
            </li>
        </a>
    

    <!-- Share LinkedIn -->
    

    <!-- Share QQ -->
    
        <a class="post_share-link" href="http://connect.qq.com/widget/shareqq/index.html?site=Twilight&#39;s Blog&title=Linux系统管理---进程管理（查看进程、终止进程、更改进程优先级）&summary=null&pics=http://yoursite.com/img/favicon.png&url=http://yoursite.com/2017/08/25/Linux系统管理-进程管理（查看进程、终止进程、更改进程优先级）/index.html" target="_blank">
            <li class="mdl-menu__item">
                分享到 QQ
            </li>
        </a>
    

    <!-- Share Telegram -->
    
</ul>

</div>

                

                <!-- Post Content -->
                <div id="post-content" class="mdl-color-text--grey-700 mdl-card__supporting-text fade out">
    
        <h1 id="查看进程"><a href="#查看进程" class="headerlink" title="查看进程"></a>查看进程</h1><h2 id="ps"><a href="#ps" class="headerlink" title="ps"></a>ps</h2><ul>
<li>ps aux</li>
</ul>
<p>查看所有进程，使用BSD操作系统格式</p>
<ul>
<li>ps -le </li>
</ul>
<p>查看系统所有进程，使用Linux标准命令格式</p>
<a id="more"></a>
<p>参数</p>
<ul>
<li>a ：显示一个终端的所有进程，</li>
<li>u ：显示进程的归属用户及内存的使用情况</li>
<li>x ：显示没有控制终端的进程</li>
<li>-l ：长格式显示。显示更加详细的信息</li>
<li>-e ：显示所有进程，和-A作用一致</li>
</ul>
<p>输出:<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]# ps aux</div><div class="line">USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND</div><div class="line">root          1  0.0  0.1  19348  1616 ?        Ss   Aug01   0:02 /sbin/init</div><div class="line">root          2  0.0  0.0      0     0 ?        S    Aug01   0:00 [kthreadd]</div><div class="line">root          3  0.0  0.0      0     0 ?        S    Aug01   0:00 [migration/0</div><div class="line">root          4  0.0  0.0      0     0 ?        S    Aug01   0:00 [ksoftirqd/0</div><div class="line">root          5  0.0  0.0      0     0 ?        S    Aug01   0:00 [stopper/0]</div><div class="line">root          6  0.0  0.0      0     0 ?        S    Aug01   0:00 [watchdog/0]</div><div class="line">root          7  0.1  0.0      0     0 ?        S    Aug01   0:37 [events/0]</div><div class="line">root          8  0.0  0.0      0     0 ?        S    Aug01   0:00 [events/0]</div><div class="line">...</div></pre></td></tr></table></figure></p>
<table>
<thead>
<tr>
<th style="text-align:left">参数</th>
<th style="text-align:left">含义</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">USER</td>
<td style="text-align:left">该进程是由哪个用户产生的</td>
</tr>
<tr>
<td style="text-align:left">PID</td>
<td style="text-align:left">进程的ID号</td>
</tr>
<tr>
<td style="text-align:left">%CPU</td>
<td style="text-align:left">改进程占用的CPU资源的百分比，占用越高，进程越耗费资源</td>
</tr>
<tr>
<td style="text-align:left">%MEM</td>
<td style="text-align:left">该进程占用的物理内存的百分比，占用越高，进程越耗费资源</td>
</tr>
<tr>
<td style="text-align:left">VSZ</td>
<td style="text-align:left">该进程占用的虚拟内存大小，单位是KB</td>
</tr>
<tr>
<td style="text-align:left">RSS</td>
<td style="text-align:left">该进程占用的物理内存大小，单位是KB</td>
</tr>
<tr>
<td style="text-align:left">TTY</td>
<td style="text-align:left">该进程是在哪个终端中运行的。tty1-tty7表示本地控制台，pts/0-255表示虚拟终端</td>
</tr>
<tr>
<td style="text-align:left">STAT</td>
<td style="text-align:left">进程状态。常见状态有 R:运行 S：睡眠 T:停止状态 s：包含子进程 +：位于后台</td>
</tr>
<tr>
<td style="text-align:left">START</td>
<td style="text-align:left">该进程的启动时间</td>
</tr>
<tr>
<td style="text-align:left">TIME</td>
<td style="text-align:left">该进程占用CPU的运算时间，不是系统时间</td>
</tr>
<tr>
<td style="text-align:left">COMMAND</td>
<td style="text-align:left">产生此进程的命令名</td>
</tr>
</tbody>
</table>
<h2 id="pstree-命令"><a href="#pstree-命令" class="headerlink" title="pstree 命令"></a>pstree 命令</h2><p>显示进程树</p>
<ul>
<li>-p：显示进程的PID</li>
<li>-u：显示进程的所属用户</li>
</ul>
<p>执行结果如下：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]# pstree -up</div><div class="line">init(1)─┬─NetworkManager(1581)─┬─dhclient(3561)</div><div class="line">        │                      └─&#123;NetworkManager&#125;(1645)</div><div class="line">        ├─abrtd(1960)</div><div class="line">        ├─acpid(1680)</div><div class="line">        ├─atd(1987)</div><div class="line">        ├─auditd(1462)───&#123;auditd&#125;(1463)</div><div class="line">        ├─automount(1767)─┬─&#123;automount&#125;(1768)</div><div class="line">        │                 ├─&#123;automount&#125;(1769)</div><div class="line">        │                 ├─&#123;automount&#125;(1772)</div><div class="line">        │                 └─&#123;automount&#125;(1775)</div><div class="line">        ├─certmonger(2003)</div><div class="line">        ├─console-kit-dae(2584)─┬─&#123;console-kit-da&#125;(2585)</div><div class="line">        │                       ├─&#123;console-kit-da&#125;(2586)</div><div class="line">        │                       ├─&#123;console-kit-da&#125;(2587)</div><div class="line">        │                       ├─&#123;console-kit-da&#125;(2588)</div><div class="line">        │                       ├─&#123;console-kit-da&#125;(2589)</div><div class="line">        │                       ├─&#123;console-kit-da&#125;(2590)</div><div class="line">        │                       ├─&#123;console-kit-da&#125;(2591)</div><div class="line">        │                       ├─&#123;console-kit-da&#125;(2592)</div><div class="line">        ├─crond(1972)</div><div class="line">        ├─cupsd(1647)</div><div class="line">        ├─dbus-daemon(1567,dbus)───&#123;dbus-daemon&#125;(1570)</div><div class="line">        ├─hald(1692,haldaemon)─┬─hald-runner(1693,root)─┬─hald-addon-acpi(1738,haldaemon)</div><div class="line">        │                      │                        └─hald-addon-inpu(1737)</div><div class="line">        │                      └─&#123;hald&#125;(1694)</div><div class="line">        ├─login(3126)───bash(3166)</div><div class="line">        ├─master(1931)─┬─pickup(21672,postfix)</div><div class="line">        │              └─qmgr(1942,postfix)</div><div class="line">        ├─mingetty(2050)</div><div class="line">        ├─mingetty(2052)</div><div class="line">        ├─mingetty(2054)</div><div class="line">        ├─mingetty(2056)</div><div class="line">        ├─mingetty(2064)</div><div class="line">        ├─modem-manager(1588)</div><div class="line">        ├─polkitd(2720)</div><div class="line">        ├─rpc.statd(1604,rpcuser)</div><div class="line">        ├─rpcbind(1547,rpc)</div><div class="line">        ├─rsyslogd(1496)─┬─&#123;rsyslogd&#125;(1497)</div><div class="line">        │                ├─&#123;rsyslogd&#125;(1498)</div><div class="line">        │                └─&#123;rsyslogd&#125;(1499)</div><div class="line">        ├─sshd(1835)───sshd(21691)───bash(21695)───pstree(21739)</div><div class="line">        ├─udevd(548)─┬─udevd(2062)</div><div class="line">        │            └─udevd(2063)</div><div class="line">        └─wpa_supplicant(1648)</div></pre></td></tr></table></figure></p>
<h1 id="top-命令"><a href="#top-命令" class="headerlink" title="top 命令"></a>top 命令</h1><p>查看系统健康状态</p>
<p>参数</p>
<ul>
<li>-d： 秒数：指定top命令每隔几秒更新。默认3秒</li>
<li>-b： 使用批处理模式输出，一般和 <code>-n</code> 合用</li>
<li>-n： 次数：指定top命令执行的次数。一般和<code>-b</code>合用</li>
</ul>
<p>交互命令：</p>
<ul>
<li>？或h：显示帮助信息</li>
<li>P:以CPU使用率排序，默认是此选项</li>
<li>M：以内存使用率排序</li>
<li>N：以PID排序</li>
<li>q：退出top</li>
</ul>
<figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div></pre></td><td class="code"><pre><div class="line">[root@localhost ~]# top</div><div class="line">top - 02:42:13 up  9:01,  2 users,  load average: 0.06, 0.04, 0.05</div><div class="line">Tasks:  97 total,   1 running,  96 sleeping,   0 stopped,   0 zombie</div><div class="line">Cpu(s):  0.2%us,  0.4%sy,  0.0%ni, 99.0%id,  0.4%wa,  0.0%hi,  0.1%si,  0.0%st</div><div class="line">Mem:   1004136k total,   824820k used,   179316k free,    39408k buffers</div><div class="line">Swap:  2031612k total,        0k used,  2031612k free,   596492k cached</div><div class="line"></div><div class="line">   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND              </div><div class="line">     7 root      20   0     0    0    0 S  2.0  0.0   0:39.59 events/0              </div><div class="line">     1 root      20   0 19348 1616 1304 S  0.0  0.2   0:02.90 init                  </div><div class="line">     2 root      20   0     0    0    0 S  0.0  0.0   0:00.01 kthreadd              </div><div class="line">     3 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0           </div><div class="line">     4 root      20   0     0    0    0 S  0.0  0.0   0:00.12 ksoftirqd/0           </div><div class="line">     5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 stopper/0             </div><div class="line">     6 root      RT   0     0    0    0 S  0.0  0.0   0:00.12 watchdog/0            </div><div class="line">     8 root      20   0     0    0    0 S  0.0  0.0   0:00.00 events/0              </div><div class="line">     9 root      20   0     0    0    0 S  0.0  0.0   0:00.00 events_long/0         </div><div class="line">    10 root      20   0     0    0    0 S  0.0  0.0   0:00.00 events_power_ef       </div><div class="line">    11 root      20   0     0    0    0 S  0.0  0.0   0:00.00 cgroup                </div><div class="line">    12 root      20   0     0    0    0 S  0.0  0.0   0:00.00 khelper               </div><div class="line">    13 root      20   0     0    0    0 S  0.0  0.0   0:00.00 netns                 </div><div class="line">    14 root      20   0     0    0    0 S  0.0  0.0   0:00.00 async/mgr             </div><div class="line">    15 root      20   0     0    0    0 S  0.0  0.0   0:00.00 pm                    </div><div class="line">    16 root      20   0     0    0    0 S  0.0  0.0   0:00.27 sync_supers           </div><div class="line">    17 root      20   0     0    0    0 S  0.0  0.0   0:00.25 bdi-default           </div><div class="line">    18 root      20   0     0    0    0 S  0.0  0.0   0:00.00 kintegrityd/0</div></pre></td></tr></table></figure>
<p>第一行</p>
<table>
<thead>
<tr>
<th style="text-align:left">内容</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">02:42:13</td>
<td style="text-align:left">系统当前时间</td>
</tr>
<tr>
<td style="text-align:left">up  9:01</td>
<td style="text-align:left">系统的运行时间</td>
</tr>
<tr>
<td style="text-align:left">2 users</td>
<td style="text-align:left">当前用户数</td>
</tr>
<tr>
<td style="text-align:left"><strong>load average: 0.06, 0.04, 0.05</strong></td>
<td style="text-align:left"><strong>系统在之前1分钟、5分钟、15分钟的平均负载。</strong></td>
</tr>
</tbody>
</table>
<p>第二行</p>
<table>
<thead>
<tr>
<th style="text-align:left">内容</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Tasks:  97 total</td>
<td style="text-align:left">系统中的进程总数</td>
</tr>
<tr>
<td style="text-align:left">1 running</td>
<td style="text-align:left">正在运行的进程数</td>
</tr>
<tr>
<td style="text-align:left">96 sleeping</td>
<td style="text-align:left">睡眠的进程数</td>
</tr>
<tr>
<td style="text-align:left">0 stopped</td>
<td style="text-align:left">正在停止的进程数</td>
</tr>
<tr>
<td style="text-align:left">0 zombie</td>
<td style="text-align:left">僵尸进程</td>
</tr>
</tbody>
</table>
<p>第三行</p>
<table>
<thead>
<tr>
<th style="text-align:left">内容</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Cpu(s):  0.2%us</td>
<td style="text-align:left">用户模式占用的CPU百分比</td>
</tr>
<tr>
<td style="text-align:left">0.4%sy</td>
<td style="text-align:left">系统模式占用的CPU百分比</td>
</tr>
<tr>
<td style="text-align:left">0.0%ni</td>
<td style="text-align:left">改变过优先级的用户进程占用的CPU百分比</td>
</tr>
<tr>
<td style="text-align:left"><strong>99.0%id </strong></td>
<td style="text-align:left"><strong>空闲的CPU百分比</strong></td>
</tr>
<tr>
<td style="text-align:left">0.4%wa</td>
<td style="text-align:left">等该输入/输出的进程占用百分比</td>
</tr>
<tr>
<td style="text-align:left">0.0%hi</td>
<td style="text-align:left">硬中断请求服务占用的CPU百分比</td>
</tr>
<tr>
<td style="text-align:left">0.1%si</td>
<td style="text-align:left">软中断请求服务占用的CPU百分比</td>
</tr>
<tr>
<td style="text-align:left">0.0%st</td>
<td style="text-align:left">st（Steal time）虚拟时间百分比，就是当有虚拟机时，虚拟机CPU等待实际CPU的时间百分比</td>
</tr>
</tbody>
</table>
<p>第四行</p>
<table>
<thead>
<tr>
<th style="text-align:left">内容</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Mem:   1004136k total</td>
<td style="text-align:left">物理内存的总量，单位KB</td>
</tr>
<tr>
<td style="text-align:left">824820k used</td>
<td style="text-align:left">已经使用的物理内存数量</td>
</tr>
<tr>
<td style="text-align:left"><strong>179316k free</strong></td>
<td style="text-align:left"><strong>空闲的物理内存数量</strong></td>
</tr>
<tr>
<td style="text-align:left">39408k buffers</td>
<td style="text-align:left">作为缓冲区的内存数量</td>
</tr>
</tbody>
</table>
<p>第五行</p>
<table>
<thead>
<tr>
<th style="text-align:left">内容</th>
<th style="text-align:left">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:left">Swap:  2031612k total</td>
<td style="text-align:left">交换分区（虚拟内存）的总大小</td>
</tr>
<tr>
<td style="text-align:left">824820k used</td>
<td style="text-align:left">已经使用的交换分区的大小</td>
</tr>
<tr>
<td style="text-align:left">0k used</td>
<td style="text-align:left">已经使用的交换分区的大小</td>
</tr>
<tr>
<td style="text-align:left">2031612k free</td>
<td style="text-align:left">空闲交换分区的大小</td>
</tr>
<tr>
<td style="text-align:left">596492k cached</td>
<td style="text-align:left">作为环迅的交换分区的大小</td>
</tr>
</tbody>
</table>
<h1 id="终止进程"><a href="#终止进程" class="headerlink" title="终止进程"></a>终止进程</h1><h2 id="kill-l-命令"><a href="#kill-l-命令" class="headerlink" title="kill -l 命令"></a>kill -l 命令</h2><ul>
<li>kill -[信号] pid<br>根据进程id杀死单一进程</li>
</ul>
<p>常见信号如下：</p>
<table>
<thead>
<tr>
<th style="text-align:center">信号代码</th>
<th style="text-align:center">信号名称</th>
<th style="text-align:center">说明</th>
</tr>
</thead>
<tbody>
<tr>
<td style="text-align:center">1</td>
<td style="text-align:center">SIGHUP</td>
<td style="text-align:center">平滑重启，关闭进程，重新读取配置文件后重启</td>
</tr>
<tr>
<td style="text-align:center">9</td>
<td style="text-align:center">SIGNKILL</td>
<td style="text-align:center">进程法伤问题时，强制结束进程</td>
</tr>
<tr>
<td style="text-align:center">15</td>
<td style="text-align:center">SIGTERM</td>
<td style="text-align:center">正常结束的金浩，kill命令的默认信号</td>
</tr>
</tbody>
</table>
<p>杀死pid为14942的进程：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">kill -1 14942</div><div class="line">kill -HUP 14942</div></pre></td></tr></table></figure></p>
<h2 id="killall-命令"><a href="#killall-命令" class="headerlink" title="killall 命令"></a>killall 命令</h2><ul>
<li>killall [信号] [选项] 进程名<br>按照进程名杀死进程</li>
</ul>
<p>选项：</p>
<ul>
<li>-i 交互式。询问是否要杀死某个进程</li>
<li>-I 忽略进程名的大小写</li>
</ul>
<p>杀死tomcat进程：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">killall -9 -I java</div></pre></td></tr></table></figure></p>
<h2 id="pkill-命令"><a href="#pkill-命令" class="headerlink" title="pkill 命令"></a>pkill 命令</h2><ul>
<li>pkill [信号] [选项] 进程名<br>按照进程名杀死进程</li>
</ul>
<p>该命令的作用与killall类似，只是多出了一个按照终端号结束用户终端的功能</p>
<ul>
<li>-t 终端号： 按照终端号踢出用户。 只有root用户可以操作</li>
</ul>
<p><code>w</code>命令查看当前用户。可知有一个本地终端和两个远程终端。WHAT表示该终端正在执行的命令。pts/1是当前终端的终端号。<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div></pre></td><td class="code"><pre><div class="line">[root@localhost bin]# w</div><div class="line"> 17:10:02 up 50 min,  3 users,  load average: 0.71, 0.21, 0.07</div><div class="line">USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT</div><div class="line">root     tty1     -                16:24   41:19   0.15s  0.15s -bash</div><div class="line">twilight pts/0    192.168.226.1    16:27   42:17   0.08s  0.08s -bash</div><div class="line">root     pts/1    192.168.226.1    16:29    0.00s  0.33s  0.05s w</div></pre></td></tr></table></figure></p>
<p>根据终端号杀死pts/0用户的终端：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">pkill -9 -t pts/0</div></pre></td></tr></table></figure></p>
<h1 id="修改进程优先级"><a href="#修改进程优先级" class="headerlink" title="修改进程优先级"></a>修改进程优先级</h1><p><code>ps -le</code>可以查看所有进程的信息，其中包括进程的优先级。PRI表示priority，NI表示nice。两个都是有点急，数字越小代表优先级越高。</p>
<p>注意事项：</p>
<ul>
<li>NI的范围是-20 到 19 </li>
<li>普通用户调整NI值得范围是0~19，而且只能调整自己的进程</li>
<li>普通用户只能调高NI值，而不能降低</li>
<li>root用户才能设定进程NI值为负值，而且可以调整任何用户的进程</li>
<li>PRI(最终值) = PRI(原始值) + NI</li>
<li>用户只能修改NI的值，不能直接修改PRI</li>
</ul>
<h2 id="nice-命令"><a href="#nice-命令" class="headerlink" title="nice 命令"></a>nice 命令</h2><ul>
<li>nice [选项] 命令<br>nice可以给新执行的命令直接赋予NI值，但是不能修改已经存在进程的NI值。</li>
</ul>
<p>选项：</p>
<ul>
<li>-n NI值： 给命令赋予NI值</li>
</ul>
<p>例如：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">nice -n -5 service httpd start</div></pre></td></tr></table></figure></p>
<h2 id="renice-命令"><a href="#renice-命令" class="headerlink" title="renice 命令"></a>renice 命令</h2><ul>
<li>renice [优先级] PID<br>修改已经存在的进程的NI值的命令</li>
</ul>
<p>例如：<br><figure class="highlight plain"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">renice -10 2125</div></pre></td></tr></table></figure></p>

    

    
</div>


                

                <!-- Post Comments -->
                
                    


    <!-- 使用 changyan -->
    <div id="changyan-comment">
        <!--PC和WAP自适应版-->
<div id="SOHUCS" sid="2017/08/25/Linux系统管理-进程管理（查看进程、终止进程、更改进程优先级）/"  ></div>
<script type="text/javascript">
(function(){
var appid = 'cysVH2p6S';
var conf = '7d191ef850d424bb873df33179309db5';
var width = window.innerWidth || document.documentElement.clientWidth;
if (width < 960) {
window.document.write('<script id="changyan_mobile_js" charset="utf-8" type="text/javascript" src="https://changyan.sohu.com/upload/mobile/wap-js/changyan_mobile.js?client_id=' + appid + '&conf=' + conf + '"><\/script>'); } else { var loadJs=function(d,a){var c=document.getElementsByTagName("head")[0]||document.head||document.documentElement;var b=document.createElement("script");b.setAttribute("type","text/javascript");b.setAttribute("charset","UTF-8");b.setAttribute("src",d);if(typeof a==="function"){if(window.attachEvent){b.onreadystatechange=function(){var e=b.readyState;if(e==="loaded"||e==="complete"){b.onreadystatechange=null;a()}}}else{b.onload=a}}c.appendChild(b)};loadJs("https://changyan.sohu.com/upload/changyan.js",function(){window.changyan.api.config({appid:appid,conf:conf})}); } })(); </script>

    </div>
    <style>
        #changyan-comment{
            background-color: #eee;
            padding: 2pc;
        }
    </style>






                
            </div>

            <!-- Post Prev & Next Nav -->
            <nav class="material-nav mdl-color-text--grey-50 mdl-cell mdl-cell--12-col">
    <!-- Prev Nav -->
    
        <a href="/2017/08/26/Linux系统管理-工作管理（后台程序管理）/" id="post_nav-newer" class="prev-content">
            <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color--white mdl-color-text--grey-900" role="presentation">
                <i class="material-icons">arrow_back</i>
            </button>
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            新篇
        </a>
    

    <!-- Section Spacer -->
    <div class="section-spacer"></div>

    <!-- Next Nav -->
    
        <a href="/2017/08/05/Linux服务管理-系统运行级别、rpm启动与自启动、源码包的启动与自启动/" id="post_nav-older" class="next-content">
            旧篇
            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <button class="mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon mdl-color--white mdl-color-text--grey-900" role="presentation">
                <i class="material-icons">arrow_forward</i>
            </button>
        </a>
    
</nav>

        </div>
    </div>



                    
                        <!-- Overlay For Active Sidebar -->
<div class="sidebar-overlay"></div>

<!-- Material sidebar -->
<aside id="sidebar" class="sidebar sidebar-colored sidebar-fixed-left" role="navigation">
    <div id="sidebar-main">
        <!-- Sidebar Header -->
        <div class="sidebar-header header-cover" style="background-image: url(/img/sidebar_header.jpg);">
    <!-- Top bar -->
    <div class="top-bar"></div>

    <!-- Sidebar toggle button -->
    <button type="button" class="sidebar-toggle mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--icon" style="display: initial;" data-upgraded=",MaterialButton,MaterialRipple">
        <i class="material-icons">clear_all</i>
        <span class="mdl-button__ripple-container">
            <span class="mdl-ripple">
            </span>
        </span>
    </button>

    <!-- Sidebar Avatar -->
    <div class="sidebar-image">
        <img src="/img/avatar.png" alt="wangchao's avatar">
    </div>

    <!-- Sidebar Email -->
    <a data-toggle="dropdown" class="sidebar-brand" href="#settings-dropdown">
        twilight0402@163.com
        <b class="caret"></b>
    </a>
</div>


        <!-- Sidebar Navigation  -->
        <ul class="nav sidebar-nav">
    <!-- User dropdown  -->
    <li class="dropdown">
        <ul id="settings-dropdown" class="dropdown-menu">
            
                <li>
                    <a href="http://mail.163.com" target="_blank" title="Email Me">
                        
                            <i class="material-icons sidebar-material-icons sidebar-indent-left1pc-element">email</i>
                        
                        Email Me
                    </a>
                </li>
            
        </ul>
    </li>

    <!-- Homepage -->
    
        <li id="sidebar-first-li">
            <a href="/" target="_self">
                
                    <i class="material-icons sidebar-material-icons">home</i>
                
                主页
            </a>
        </li>
        
    

    <!-- Archives  -->
    
        <li class="dropdown">
            <a href="#" class="ripple-effect dropdown-toggle" data-toggle="dropdown">
                
                    <i class="material-icons sidebar-material-icons">inbox</i>
                
                    归档
                <b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
            <li>
                <a class="sidebar_archives-link" href="/archives/2017/08/">八月 2017<span class="sidebar_archives-count">5</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/07/">七月 2017<span class="sidebar_archives-count">23</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/06/">六月 2017<span class="sidebar_archives-count">13</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/04/">四月 2017<span class="sidebar_archives-count">7</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/03/">三月 2017<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/02/">二月 2017<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/archives/2017/01/">一月 2017<span class="sidebar_archives-count">8</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/12/">十二月 2016<span class="sidebar_archives-count">4</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/11/">十一月 2016<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/archives/2016/09/">九月 2016<span class="sidebar_archives-count">3</span></a>
            </ul>
        </li>
        
    

    <!-- Categories  -->
    
        <li class="dropdown">
            <a href="#" class="ripple-effect dropdown-toggle" data-toggle="dropdown">
                
                    <i class="material-icons sidebar-material-icons">chrome_reader_mode</i>
                
                分类
                <b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
                <li>
                <a class="sidebar_archives-link" href="/categories/CSS/">CSS<span class="sidebar_archives-count">9</span></a></li><li><a class="sidebar_archives-link" href="/categories/HTML/">HTML<span class="sidebar_archives-count">3</span></a></li><li><a class="sidebar_archives-link" href="/categories/JSP/">JSP<span class="sidebar_archives-count">6</span></a></li><li><a class="sidebar_archives-link" href="/categories/Java/">Java<span class="sidebar_archives-count">8</span></a></li><li><a class="sidebar_archives-link" href="/categories/JavaScript/">JavaScript<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/Linux/">Linux<span class="sidebar_archives-count">13</span></a></li><li><a class="sidebar_archives-link" href="/categories/MySQL/">MySQL<span class="sidebar_archives-count">7</span></a></li><li><a class="sidebar_archives-link" href="/categories/Servlet/">Servlet<span class="sidebar_archives-count">9</span></a></li><li><a class="sidebar_archives-link" href="/categories/jQuery/">jQuery<span class="sidebar_archives-count">7</span></a></li><li><a class="sidebar_archives-link" href="/categories/技术/">技术<span class="sidebar_archives-count">2</span></a></li><li><a class="sidebar_archives-link" href="/categories/日常/">日常<span class="sidebar_archives-count">1</span></a></li><li><a class="sidebar_archives-link" href="/categories/随笔/">随笔<span class="sidebar_archives-count">3</span></a>
            </ul>
        </li>
        
    

    <!-- Pages  -->
    
        <li>
            <a href="/tags" title="标签云">
                
                    <i class="material-icons sidebar-material-icons">cloud</i>
                
                标签云
            </a>
        </li>
        
            <li class="divider"></li>
        
    
        <li>
            <a href="/about" title="About">
                
                    <i class="material-icons sidebar-material-icons">person</i>
                
                About
            </a>
        </li>
        
    
        <li>
            <a href="/links" title="Social">
                
                    <i class="material-icons sidebar-material-icons">equalizer</i>
                
                Social
            </a>
        </li>
        
    

    <!-- Article Number  -->
    
        <li>
            <a href="/archives">
                文章总数
                <span class="sidebar-badge">71</span>
            </a>
        </li>
        
    
</ul>


        <!-- Sidebar Footer -->
        <!--
I'm glad you use this theme, the development is no so easy, I hope you can keep the copyright, I will thank you so much.
If you still want to delete the copyrights, could you still retain the first one? Which namely "Theme Material"
It will not impact the appearance and can give developers a lot of support :)

很高兴您使用并喜欢该主题，开发不易 十分谢谢与希望您可以保留一下版权声明。
如果您仍然想删除的话 能否只保留第一项呢？即 "Theme Material"
它不会影响美观并可以给开发者很大的支持和动力。 :)
-->

<!-- Sidebar Divider -->

    <div class="sidebar-divider"></div>


<!-- Theme Material -->


<!-- Help & Support -->
<!--

-->

<!-- Feedback -->
<!--

    <a href="https://github.com/viosey/hexo-theme-material/issues" target="_blank" class="sidebar-footer-text-a">
        <div class="sidebar-text mdl-button mdl-js-button mdl-js-ripple-effect sidebar-footer-text-div" data-upgraded=",MaterialButton,MaterialRipple">
        sidebar.feedback
        <span class="mdl-button__ripple-container"><span class="mdl-ripple"></span></span></div>
    </a>

-->

<!-- About Theme -->
<!--

    <a href="https://blog.viosey.com/index.php/Material.html" target="_blank" class="sidebar-footer-text-a">
        <div class="sidebar-text mdl-button mdl-js-button mdl-js-ripple-effect sidebar-footer-text-div" data-upgraded=",MaterialButton,MaterialRipple">
             sidebar.about_theme
            <span class="mdl-button__ripple-container"><span class="mdl-ripple"></span></span></div>
    </a>

-->

    </div>

    <!-- Sidebar Image -->
    

</aside>

                    

                    
                        <!-- Footer Top Button -->
                        <div class="toTop-wrap">
    <a href="#top" class="toTop">
        <i class="material-icons footer_top-i">expand_less</i>
    </a>
</div>

                    

                    <!--Footer-->
<footer class="mdl-mini-footer" id="bottom">
    
        <!-- Paradox Footer Left Section -->
        <div class="mdl-mini-footer--left-section sns-list">
    <!-- Twitter -->
    
        <a href="https://twitter.com/twitter" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-twitter.svg);">
                <span class="visuallyhidden">Twitter</span>
            </button><!--
     --></a>
    

    <!-- Facebook -->
    
        <a href="https://www.facebook.com/facebook" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-facebook.svg);">
                <span class="visuallyhidden">Facebook</span>
            </button><!--
     --></a>
    

    <!-- Google + -->
    
        <a href="https://www.google.com/" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-gplus.svg);">
                <span class="visuallyhidden">Google Plus</span>
            </button><!--
     --></a>
    

    <!-- Weibo -->
    

    <!-- Instagram -->
    

    <!-- Tumblr -->
    

    <!-- Github -->
    
        <a href="https://github.com/1601436878" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-github.svg);">
                <span class="visuallyhidden">Github</span>
            </button><!--
     --></a>
    

    <!-- LinkedIn -->
    

    <!-- Zhihu -->
    
        <a href="https://www.zhihu.com/people/wang-chao-50-78/activities" target="_blank">
            <button class="mdl-mini-footer--social-btn social-btn" style="background-image: url(/img/footer/footer_ico-zhihu.svg);">
                <span class="visuallyhidden">Zhihu</span>
            </button><!--
     --></a>
    

    <!-- Bilibili -->
    

    <!-- Telegram -->
    
</div>


        <!--Copyright-->
        <div id="copyright">
            Copyright&nbsp;©&nbsp;
            <script type="text/javascript">
                var fd = new Date();
                document.write(fd.getFullYear());
            </script>
            &nbsp;Twilight's Blog
        </div>

        <!-- Paradox Footer Right Section -->

        <!--
        I am glad you use this theme, the development is no so easy, I hope you can keep the copyright.
        It will not impact the appearance and can give developers a lot of support :)

        很高兴您使用该主题，开发不易，希望您可以保留一下版权声明。
        它不会影响美观并可以给开发者很大的支持。 :)
        -->

        <div class="mdl-mini-footer--right-section">
            <div>
                <div class="footer-develop-div">Powered by <a href="https://hexo.io" target="_blank" class="footer-develop-a">Hexo</a></div>
                <div class="footer-develop-div">Theme - <a href="https://github.com/viosey/hexo-theme-material" target="_blank" class="footer-develop-a">Material</a></div>
            </div>
        </div>
    
</footer>


                    <!-- Import File -->

    <script src="/js/lazyload.min.js"></script>
    <script src="/js/js.min.js"></script>



    <script src="/js/nprogress.js"></script>


<script type="text/javascript">
    NProgress.configure({
        showSpinner: true
    });
    NProgress.start();
    $('#nprogress .bar').css({
        'background': '#29d'
    });
    $('#nprogress .peg').css({
        'box-shadow': '0 0 10px #29d, 0 0 15px #29d'
    });
    $('#nprogress .spinner-icon').css({
        'border-top-color': '#29d',
        'border-left-color': '#29d'
    });
    setTimeout(function() {
        NProgress.done();
        $('.fade').removeClass('out');
    }, 800);
</script>





    <!-- Leancloud -->
    <script src="https://cdn1.lncld.net/static/js/av-core-mini-0.6.1.js"></script>
    <script>
        AV.initialize('WJXlEXdVypRaytiRUYDL9Q4w-gzGzoHsz', 'qNN24AGgbaMqnDE7lqK8pwCD');
    </script>
    <script>
    function showTime(Counter) {
        var query = new AV.Query(Counter);
        $('.leancloud-views_num').each(function() {
            var url = $(this).attr('id').trim();
            query.equalTo('url', url);
            query.find({
                success: function(results) {
                    if (results.length === 0) {
                        var content = '0 ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                        return;
                    }
                    for (var i = 0; i < results.length; i++) {
                        var object = results[i];
                        var content = object.get('time') + ' ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                    }
                },
                error: function(object, error) {
                    console.log('Error: ' + error.code + ' ' + error.message);
                }
            });
        });
    }

    function addCount(Counter) {
      var Counter = AV.Object.extend('Counter');
      url = $('.leancloud-views_num').attr('id').trim();
      title = $('.leancloud-views_num').attr('data-flag-title').trim();
      var query = new AV.Query(Counter);
      query.equalTo('url', url);
      query.find({
          success: function(results) {
            if (results.length > 0) {
                var counter = results[0];
                counter.fetchWhenSave(true);
                counter.increment('time');
                counter.save(null, {
                    success: function(counter) {
                        var content =  counter.get('time') + ' ' + $(document.getElementById(url)).text();
                        $(document.getElementById(url)).text(content);
                    },
                    error: function(counter, error) {
                        console.log('Failed to save Visitor num, with error message: ' + error.message);
                    }
                });
            } else {
              var newcounter = new Counter();
              newcounter.set('title', title);
              newcounter.set('url', url);
              newcounter.set('time', 1);
              newcounter.save(null, {
                  success: function(newcounter) {
                      console.log('newcounter.get(\'time\')='+newcounter.get('time'));
                      var content = newcounter.get('time') + ' ' + $(document.getElementById(url)).text();
                      $(document.getElementById(url)).text(content);
                  },
                  error: function(newcounter, error) {
                      console.log('Failed to create');
                  }
              });
            }
        },
        error: function(error) {
            console.log('Error:' + error.code + ' ' + error.message);
        }
      });
    }
    $(function() {
        var Counter = AV.Object.extend('Counter');
        if ($('.leancloud-views_num').length === 1) {
            addCount(Counter);
        } else if ($('.post-title-link').length > 1) {
            showTime(Counter);
        }
    });
</script>







    <!-- 畅言公共 js 代码 start -->
		<script id="cy_cmt_num" src="https://changyan.sohu.com/upload/plugins/plugins.list.count.js?clientId=cysVH2p6S">
</script>
    <!-- 畅言公共 js 代码 end -->







<!-- Window Load-->
<script>
    $(window).load(function() {
        // Post_Toc parent position fixed
        $('.post-toc-wrap').parent('.mdl-menu__container').css('position', 'fixed');
    });
</script>

<!-- MathJax Load-->

<script>
    <!-- Offer LazyLoad -->
    queue.offer(function(){
        $('.lazy').lazyload({
            effect : 'show'
        });
    });

    <!-- Start Queue -->
    $(document).ready(function(){
        setInterval(function(){
            queue.execNext();
        },200);
    });
</script>

                </main>
            </div>
			<!--  -->
				<!--<script type="text/javascript" count="200" color="0,0,255" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script>-->
			<!--  -->
        </body>
    
</html>
